import { createApp } from 'vue'
import { createPinia } from 'pinia'

// Element-plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

// 图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 中国化
import zhCn from  'element-plus/es/locale/lang/zh-cn'

import App from './App.vue'
import router from './router'


const app = createApp(App)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

app.use(createPinia())
app.use(router)
app.use(ElementPlus,{locale:zhCn})
app.mount('#app')

//配置根路径
const BASE_URL = 'http://localhost:8080';
//window里面添加的内容是全局内容，可以在任意script标签内部使用
window.BASE_URL = BASE_URL;

//定义获取用户信息的全局方法
window.getUser = ()=>{
    return localStorage.user?JSON.parse(localStorage.user):null;
}